package com.cytech.cloudclinic.moudle.main.patient.add;

import com.cytech.cloudclinic.base.BaseBean;
import com.cytech.cloudclinic.base.BaseObserver;
import com.cytech.cloudclinic.base.BasePresenter;
import com.cytech.cloudclinic.bean.Patient;
import com.yechaoa.yutils.ToastUtil;

public class AddPatientPresenter extends BasePresenter<AddPatientView> {
    public AddPatientPresenter(AddPatientView baseView) {
        super(baseView);
    }

    /**
     * 新增患者
     */
    void addPatient(Patient patient) {
        addDisposable(apiServer.addPatient(objectToRequestBody(patient)), new BaseObserver<BaseBean<Object>>(baseView, true) {

            @Override
            public void onSuccess(BaseBean<Object> o) {
                baseView.addPatientSuccess();
            }

            @Override
            public void onError(String msg) {
                ToastUtil.showToast(msg);
            }
        });
    }
}
